package com.wyu.servlet;

import com.wyu.dao.SelectSCDao;
import com.wyu.dao.SelectSCDaoImpl;
import com.wyu.pojo.SC;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/SelectScmcServlet")
public class SelectScmcServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String scmc = request.getParameter("scmc");
        System.out.println("食材名称"+scmc);
        HttpSession session = request.getSession();
        SelectSCDao dao = new SelectSCDaoImpl();
        List<SC> list4 = dao.searchscmc(scmc);
        session.setAttribute("sc", list4);
        response.sendRedirect("hwxx.jsp");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
